Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX (Extension) @W-16733527@ Additional telemetry for apex guru #139

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

jag-j
Copy link
Collaborator

@jag-j jag-j commented Sep 27, 2024

This gets the following telemetry:
Number of antipatterns count
Number of violations with suggestions
Number of quick-fix accepted

duration: (Date.now() - startTime).toString()
duration: (Date.now() - startTime).toString(),
violationsCount: ruleResult.violations.length.toString(),
violationsWithSuggestedCode: getViolationsWithSuggestions(ruleResult).toString()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be violationsWithSuggestedCodeCount to match violationsCount?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! that sounds better. I'll rename it.

const range = this.diagnostic.range; // Assuming the range is the location of the existing code in the document
const diagnosticStartLine = new vscode.Position(range.start.line, range.start.character);
edit.insert(document.uri, diagnosticStartLine, suggestedCode + '\n');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I do this, there is no way to get the telemetry on how many times users clicked on the "include apex guru suggestions" quick-fix. I had to to make this a command and add it to the action and I can report telemetry on that command.

const edit = new vscode.WorkspaceEdit();
edit.insert(document.uri, position, suggestedCode);
await vscode.workspace.applyEdit(edit);
TelemetryService.sendCommandEvent(Constants.TELEM_SUCCESSFUL_APEX_GURU_FILE_ANALYSIS, {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New telemetry to get number of times users used the suggestions ApexGuru provided, along with the number of lines that were included.

@jag-j jag-j merged commit bb6e7ff into dev Sep 30, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants